package com.leyou.item.web;


import com.leyou.item.dto.AclModuleLevelDto;
import com.leyou.item.pojo.AclModule;
import com.leyou.item.service.AclModuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author:yanjizhw@163.com
 * @date:2019-10-12 8:24
 * 描述:
 * @since:1.0.0
 */
@Controller
@RequestMapping("aclModule")
public class AclModuleController {

    @Autowired
    private AclModuleService aclModuleService;

    @RequestMapping("saveAclModule")
    public String saveAclModule(AclModule aclModule){

        aclModuleService.save(aclModule);

        return "permission";
    }

    @GetMapping("tree")
    public ResponseEntity<List<AclModuleLevelDto>> queryAclModuleTree(){

        return ResponseEntity.ok(aclModuleService.queryAclModuleTree());
    }

    @ResponseBody
    @RequestMapping("getSelect")
    public ResponseEntity<List<AclModule>> getSelect(){

        List<AclModule> Lists = aclModuleService.querySelect();

        return ResponseEntity.ok(Lists);
    }
}
